# -*-coding = utf-8 -*-
# @Time : 2022/10/18 21:10
# @Author : Oliver
# @File : 24点.py
# @Software :PyCharm
from operator import truediv, mul, add, sub


def judgePoint24(A):
    if not A:
        return False
    # 终止条件
    if len(A) == 1:
        return abs(A[0] - 24) < 1e-6

    for i in range(len(A)):
        for j in range(len(A)):
            if i != j:
                # 除i、j外，剩下的数放入B
                B = [A[k] for k in range(len(A)) if i != k != j]

                for op in (truediv, mul, add, sub):
                    # 加法和乘法会有重复情况，可以忽略其中一个
                    if (op is add or op is mul) and j > i:
                        continue

                    if op is not truediv or A[j]:
                        B.append(op(A[i], A[j]))
                        if judgePoint24(B):
                            return True
                        B.pop()
    return False


arr = list(map(int, input().split()))
print(judgePoint24(arr))
